<?php
// +----------------------------------------------------------------------
// | HkCms 栏目分类验证
// +----------------------------------------------------------------------
// | Copyright (c) 2020-2021 http://www.hkcms.cn, All rights reserved.
// +----------------------------------------------------------------------
// | Author: 广州恒企教育科技有限公司 <admin@hkcms.cn>
// +----------------------------------------------------------------------

declare (strict_types=1);

namespace addons\excels\validate;

use think\Validate;

class Category extends Validate {

    /**
     * 定义验证规则
     * 格式：'字段名'    =>    ['规则1','规则2'...]
     * @var array
     */
    protected $rule = [
        'model_id' => 'require|number',
        'category_id' => 'require|number',
        'title' => 'require|max:200',
        'status' => "require|in:normal,hidden,reject,audit",
//        'image' => 'url',
        'diyname' => 'alphaNum|unique:archives',
        'seo_title' => 'max:250',
        'seo_keywords' => 'max:250',
        'seo_desc' => 'max:250',
        'weigh' => 'number',
        'num' => 'number',
    ];
    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     * @var array
     */
    protected $message = [
        'model_id.require' => '模型错误',
        'model_id.number' => '模型错误',

        'category_id.require' => '栏目错误',
        'category_id.number' => '栏目错误',

        'title.require' => '名称或标题必须',
        'title.max' => '名称或标题最多200字',

        'status.require' => '状态必须',
        'status.in' => '状态可选值为 normal,hidden,reject,audit',

        'diyname.alphaNum' => '自定义URL名格式错误，只允许字母和数字',
        'diyname.unique' => '自定义URL重复',
    ];
}